


if __name__ == '__main__':
    train_txt = 'dataset/1718level/train.txt'
    test_txt = 'dataset/1718level/test_1718.txt'
    save_train_path = 'dataset/1718level/train_t.txt'
    save_test_path = 'dataset/1718level/test_t.txt'
    train_items = []
    test_items = []

    # train
    with open(train_txt, 'r') as f:
        data = f.readlines()
        for d in data:
            img_temp = './images/' + d.strip() + '.jpg\n'
            txt_temp = './labelTxt/' + d.strip() + '.txt\n'
            train_items.append(img_temp)
            train_items.append(txt_temp)

    with open(save_train_path, 'a+') as f:
        f.writelines(train_items)

    # test
    with open(test_txt, 'r') as f:
        data = f.readlines()
        for d in data:
            img_temp = './images/' + d.strip() + '.jpg\n'
            txt_temp = './labelTxt/' + d.strip() + '.txt\n'
            test_items.append(img_temp)
            test_items.append(txt_temp)

    with open(save_test_path, 'a+') as f:
        f.writelines(test_items)


